//
//  RegistSetupThree.m
//  HB
//
//  Created by 孙智慧 on 16/1/27.
//  Copyright © 2016年 孙智慧. All rights reserved.
//

#import "RegistSetupThree.h"
#import "RegistSetupFour.h"

@implementation RegistSetupThree

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    CGFloat  heigh =41;
    
    if(IsiPhone6 || IsiPhone6P)
    {
        heigh=41;
    }
    else{
        heigh=35;
    }
    
    NSLayoutConstraint* heightConstraint = [NSLayoutConstraint constraintWithItem:self.navImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0f constant:heigh];
    
    [self.view addConstraint:heightConstraint];
}

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
    //显示导航栏
    [super.navigationController setNavigationBarHidden:NO animated:TRUE];
    //[super.navigationController setToolbarHidden:NO animated:TRUE];
    
    [self setNavigationRight:@"下一步" sel:@selector(nextSteup)];
    
}

-(void) nextSteup
{
    if ([self.txtUName.text isEqualToString:@""])
    {
        [Common showMsg:@"用户名不能为空！" andCancel:YES andHost:self];
    }
    else if(![Common isVerifyPwd:self.txtPwd.text])
    {
        [Common showMsg:@"密码格式不正确！" andCancel:YES andHost:self];
    }
    else if([self.txtPwd.text isEqualToString:@""])
    {
        [Common showMsg:@"密码不能为空！" andCancel:YES andHost:self];
    }
    else if (![self.txtPwd.text isEqualToString:self.txtPwdAgain.text])
    {
        [Common showMsg:@"两次输入的密码不一致" andCancel:YES andHost:self];
    }
    else{
        
        [BaseLoginController setUName:self.txtUName.text];
        
        [BaseLoginController setPwd:self.txtPwd.text];
        
        RegistSetupFour *registSetuoFour= [[RegistSetupFour alloc] init];
        
        registSetuoFour.uName=self.txtUName.text;
        
        [self.navigationController  pushViewController:registSetuoFour animated:YES];
    }
}

@end
